<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="name" prop="name">
        <div ref="editor" />
      </el-form-item>
      <!-- <el-form-item>
        {{ eText }}
      </el-form-item>
      <el-form-item>
        {{ eHtml }}
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即创建</el-button>
      </el-form-item>
    </el-form>

    <div ref="content" />
  </div>
</template>

<script>
import E from 'wangeditor'
export default {
  name: 'cMark2',
  data() {
    return {
      form: {
        name: ''
      },
      editor: '',
      eText: '',
      eHtml: '',
      dialogVisible: false
    }
  },
  mounted() {
    this.editor = new E(this.$refs.editor)
    this.editor.create() // 创建富文本实例
  },
  methods: {
    onSubmit() {
      this.eText = this.editor.txt.text()
      this.eHtml = this.editor.txt.html()
      this.$refs.content.innerHTML = this.eHtml
    }
  }
}
</script>

<style>

</style>
